<!-- 社保政策 -->
<template>
  <div class="page-box h100 display-flex czbj">
    <p class="title-label mb10">社保政策</p>
    <!-- sonRouter="yybureauFormationBJ" 为跳转新的页面编辑 -->
    <dxtable
      :dataJson="dataJson"
      :portUrl="portUrl"
      :formJson="formJson"
      sonRouter="jiacaihuibjshebao"
      :qx="qx"
      ref="databale"
    ></dxtable>
  </div>
</template>
<script lang="ts" setup>
import dxtable from "../../components/util/dxtable.vue";
import sort from "../../components/util/sort.vue";
import { dxget, dxpost } from "../../util/index";
import { NButton, NImage, NTag } from "naive-ui";
import { h, ref, reactive } from "vue";
const databale = ref();
const initeer = () => {
  databale.value.initDataExpose();
};
let dataJson = [
  {
    title: "标题",
    type: "input",
    val: "",
    icon: "dx-shurukuang",
    span: 12,
    key: "title",
    width: "",
    search: true,
    istable: true,
    required: false,
  },
  {
    title: "年份",
    type: "input",
    val: "",
    icon: "dx-shurukuang",
    span: 12,
    key: "year",
    width: "",
    search: false,
    istable: true,
    required: false,
  },

  {
    title: "养老保险",
    render: (row) => {
      const jmxsd = JSON.parse(row.jsonData);
      return jmxsd[0].fdsfd2;
    },
  },
  {
    title: "医疗保险",
    render: (row) => {
      const jmxsd = JSON.parse(row.jsonData);
      return jmxsd[1].fdsfd2;
    },
  },
  {
    title: "失业保险",
    render: (row) => {
      const jmxsd = JSON.parse(row.jsonData);
      return jmxsd[2].fdsfd2;
    },
  },
  {
    title: "工伤保险",
    render: (row) => {
      const jmxsd = JSON.parse(row.jsonData);
      return jmxsd[3].fdsfd2;
    },
  },
  {
    title: "残保金",
    render: (row) => {
      const jmxsd = JSON.parse(row.jsonData);
      return jmxsd[4].fdsfd2;
    },
  },
  {
    title: "生育保险",
    render: (row) => {
      const jmxsd = JSON.parse(row.jsonData);
      return jmxsd[5].fdsfd2;
    },
  },
  {
    title: "企业缴纳",
    key: "qyjn",
  },
  {
    title: "个人缴纳",
    key: "grjn",
  },
  {
    title: "合计",
    key: "heji",
  },
  {
    title: "排序",
    width: 100,
    render: (row) => {
      row.sjk = "xtgx"; //数据库
      row.databaseName = "keyEnterprise"; //表名
      return h(sort, {
        row,
        onCallBack: () => {
          initeer();
        },
      });
    },
  },
  {
    title: "添加时间",
    key: "addTime",
    width: 150,
  },
];

const qx = {
  DeletePermissionID: "jiacaihuisbzcdel", //删除
  EditPermissionIdentifier: "jiacaihuisbzcbj", // 编辑
  NewPermissionIdentifier: "jiacaihuisbzcxz", // 新建
  ViewPermissionID: "jiacaihuisbzcck", // 查看
};
const portUrl = "jiacaihui/sbzc";

let formJson = reactive([
  {
    title: "标题",
    type: "input",
    val: "",
    icon: "dx-shurukuang",
    span: 12,
    key: "title",
    width: "",
    search: false,
    istable: true,
    required: false,
  },
  {
    title: "年份",
    type: "input",
    val: "",
    icon: "dx-shurukuang",
    span: 12,
    key: "year",
    width: "",
    search: false,
    istable: true,
    required: false,
  },
]);
const czFun = {
  fun: (row) => {
    return [
      h(
        NButton,
        {
          type: "info",
          quaternary: true,
          onClick: async (e) => {},
        },
        "复制代码"
      ),
    ];
  },
};

// 获取字典内容
// const xtgxxmfl = async () => {
//   const { data }: any = await dxget("dxgjAdmin/getzd", { name: 'xtgxxmfl' })
//   dataJson[2].options = [
//     {
//       label: "全部",
//       value: ""
//     },
//     ...data
//   ]
//   formJson[2].options = data
//   xmlxSelect.value = data
//   console.log(data);
// }
// xtgxxmfl()
</script>
<style scoped></style>
